<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>生产登记</title>
    <!-- Google Font: Source Sans Pro -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../dist/css/adminlte.min.css">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="../plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
</head>
<body > <!--onload="registration()"-->
    <link rel="stylesheet"  href="../css/bootstrap.min.css">
    <link rel="stylesheet"  href="../css/bootstrap-table.min.css">
    <script src="../js/jquery.min.js" ></script>
    <script src="../js/bootstrap.bundle.min.js" ></script>
    <script src="../js/bootstrap.min.js"  ></script>
    <script src="../js/bootstrap-table.min.js"  ></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../js/index.js"></script>
    <input type="radio" value="G004-1" name="sta">已完成
<input type="radio" value="G004-2" name="sta">未完成
<table id="tab">
    <tr>
        <th>序号</th>
        <th>物料名</th>
        <th>物料编号</th>
        <th>本次数量</th>
    </tr>
</table>
    <div class="row">
        <div class="col">
            派单编号：<input id="id" class="form-control">
        </div>
        <div class="col">
            工序名：<input id="name" class="form-control">
        </div>
    </div>

    <div class="row">
    <div class="col">
        负责人：<input id="designer" class="form-control">
    </div>
    <div class="col">
        登记人：<input id="register" class="form-control">
    </div>
</div>
<div class="row">
    <div class="col">
        设计工时：<input id="num" class="form-control">
    </div>
    <div class="col">
        本次工时：<input id="sum" class="form-control">
    </div>
</div>
    <button class="btn btn-outline-dark" onclick="sub()">提交</button>
<button class="btn btn-outline-dark" onclick="ck()">返回</button>
<script>
    alert($("input:hidden").length)
    $("#designer").val(localStorage.getItem("designer"))
    $("#register").val(localStorage.getItem("register"))
    $("#id").val(localStorage.getItem("id"))
    $("#name").val(localStorage.getItem("bz"))
    $("#sum").val(localStorage.getItem("num"))
    $("#num").val(localStorage.getItem("num"))
   /*function f1() {
       $.post("../scdj/querydatil",{"parentId":$("#id").val()},function (date) {
           var table=$("#tab")
           $(data.list).each(function (index,item) {
               var tr=$("<tr><td>"+item.id+"</td><td>"+item.productName+"</td>" +
                   "<td><input type='hidden' name='name' value='"+item.productId+"'> "+item.productId+"</td><td><input type='text' name='num'></td>" +
                   "</tr>");
               table.append(tr);
           })
       },"json")
   }*/
    f();
    function f(){
        //../scjh/querybyid
        $.post("../scjh/querybyid",function (date) {
            var table=$("#tab")
            var a=""
            var b=""
            $(date.list).each(function (index,item) {
                if (item.manufactureProcedureTag=="G004-3") {
                    a = "交接登记"
                    b="完成"

                }
                if(item.manufactureProcedureTag=="G004-0"){
                    b = "<button class='btn-outline-dark btn' onclick='ck()'>登记</button>"
                }
                if (item.manufactureProcedureTag=="G004-1"){
                    b="待审核"
                }
                var tr=$("<tr><td>"+item.id+"</td><td>"+item.procedureName+"</td>" +
                    "<td>"+item.register+"</td><td>"+item.labourHourAmount+"</td>" +
                    "<td>"+item.subtotal+"</td><td>"+b+"</td>" +
                    "<ta><a onclick='cks("+item.id+")'>"+a+"</a></ta></tr>");
                table.append(tr);
            })
        },"json")
    }

   function ck() {
        location.href="query.html";
   }
   function sub() {
        alert()
        var j=$("input:hidden").length;
        var a="";//物料id
        var num="";
        for (var i=0;i<=j-1;i++){
            a=","+a+$(":hidden:eq("+i+")").val();//是物料编号
            num=","+num+$(":text:eq("+i+")").val();
        }
        $.post("../scdj/update",{"productId":a,"amount":num,"":$("#id").val(),"procedureFinishTag":$("input:radio:checked").val()},function (date) {//传多个值

        },"json")
   }
</script>
</body>
</html>